<form method="post" action="{-$body.url-}&act={-if $L.id-}eok&id={-$L.id-}{-else-}aok{-/if-}" id="Field_Form">

<div class="bodytabdiv">
<table class='bodytab' cellspacing='1' id="columnx">
<tr>
	<th class='th' colspan='2'>{-if $L.id-}修改{-else-}添加{-/if-}字段节点</th>
</tr>

<tr>
	<td width='90'>数据表</td>
	<td>{-$P.tableName-}</td>
</tr>

<tr>
	<td>字段键</td>
	<td><input name="fieldKey" value='{-$L.fieldKey-}'/></td>
</tr>

<tr>
	<td>字段名</td>
	<td><input name='fieldName' value='{-$L.fieldName-}'></td>
</tr>


<tr>
	<td >优先级</td>
	<td><input name='orderId' value='{-$L.orderId|default:'0'-}' size='2' maxlength='2'></td>
</tr>

{-if $P.isGroup-}

<tr>
	<td>分组</td>
	<td>
		<select name="gid">
			{-foreach from=$Groups key=gid item=a-}
				<option value="{-$gid-}" {-if $gid==$L.gid-} selected="selected" class="selected"{-/if-}>{-$a.name-}</option>
			{-/foreach-}
		</select>
	</td>
</tr>
{-/if-}


<tr>
	<td >表单类型</td>
	<td>
		<select name="elementType">
		{-foreach from=$body.elements item=v key=k-}
		<option value='{-$k-}' {-if $k==$L.elementType-}selected="true" class="selected"{-/if-}>{-$v-} </option>
		{-/foreach-}</select>
		
	</td>
</tr>

<tr depends="elementType:['select','radio','xhr','checkbox','text','time','textarea','richtext','xhr','file','date','color']">
 <td>是否可编改</td>
 <td>
	<label for="d_isEdit1"><input type="radio" name="isEdit" id="d_isEdit1" value='1'{-if $L.isEdit-} checked='true'{-/if-}>是</label>
	<label for="d_isEdit0"><input type="radio" name="isEdit" id="d_isEdit0" value='0'{-if !$L.isEdit-} checked='true'{-/if-}>否</label>
 </td>
</tr>


<tr depends="elementType:['radio','checkbox','text','date','color']">
 <td>是否必填</td>
 <td>
	<label for="d_isForce1"><input type="radio" name="isForce" id="d_isForce1" value='1'{-if $L.isForce-} checked='true'{-/if-}>是</label>
	<label for="d_isForce0"><input type="radio" name="isForce" id="d_isForce0" value='0'{-if !$L.isForce-} checked='true'{-/if-}>否</label>
 </td>
</tr>


<tr depends="elementType:['xhr']" val="{-$L.DepField-}">
 <td>父择框</td>
 <td>
	{-foreach from=$body.form_xhr item=v key=k-}
		<label for="d_DepField_{-$k-}"><input type="radio" name="DepField" id="d_DepField_{-$k-}" value="{-$k-}">{-$v-}</label>
	{-/foreach-}
 </td>
</tr>

<tr depends="elementType:['select','radio','checkbox']">
 <td>是否据值授权</td>
 <td>

	<label for="d_isPower1"><input type="radio" name="isPower" id="d_isPower1" value='1'{-if $L.isPower-} checked='true'{-/if-}>是</label>
	<label for="d_isPower0"><input type="radio" name="isPower" id="d_isPower0" value='0'{-if !$L.isPower-} checked='true'{-/if-}>否</label>
 </td>
</tr>

<tr depends="elementType:['text','password','select','xhr']">
	<td>Size</td>
	<td><input name='size' value='{-$L.size-}' size='2' maxlength='2'/> <a class="note">文本框容纳字符数</a></td>
</tr>

<tr depends="elementType:['select','radio','checkbox','file','text','textarea']">
	<td>正则匹配</td>
	<td><input name='regs' value='{-$L.regs-}' size="34"></td>
</tr>


<tr depends="elementType:['file']">
	<td class="note">表达式</td>
	<td> <a  class="note">图片:  ^$|\.jpe?g$|\.gif$|\.png$|\.bmp$</a></td>
</tr>


<tr depends="elementType:['select','radio','checkbox','file','text','textarea']">
	<td>正则警告</td>
	<td><input name='alert' value='{-$L.alert-}' size="54" /></td>
</tr>

<tr depends="elementType:['select','radio','checkbox','file','text','textarea', 'color']">
	<td>注释</td>
	<td><input name='note' value='{-$L.note-}' size="54" /></td>
</tr>




<tr depends="elementType:['select','radio','checkbox']">
	<td width="90">绑定参数组</td>
	<td> <a class="updown0" href="#x1" name="x1">展开</a><div class="checkboxlist"  style="display:none">{-$body.param_radio-}</div></td>
</tr>


<tr>
	<td>显示依赖</td>
	<td><a class="updown0" href="#x2" name="x2">展开</a><div class="checkboxlist" style="display:none">{-$body.need_checkbox-}</div></td>
</tr>

{-if $body.xhr_need!=""-}

<tr>
	<td>显示依赖2</td>
	<td><a class="updown0" href="#x3" name="x3">展开</a><div class="checkboxlist" style="display:none">{-$body.xhr_need-}</div></td>
</tr>


{-/if-}

</table>
</div>


<input type='hidden' name='jurl' value='{-$_ENV.referer-}'>

<div class='bodysubmit'>
<input type='submit' value='递交'>
<input type='reset' value='默认'>
</div>

</form>

<div class='bodyfooter'>
	<a href='{-$_ENV.referer-}'>返回</a>
</div>

<script type="text/javascript">

new XForm('columnx', function(){
	var elements	= this.dom.elements;
	try{
		var e	= elements["fieldKey"];
		if(!e.value.match(/^[\w\_]{1,20}$/)){
			alert('字段键不能少于1个字母,并且不能包含特殊字符!');
			e.select(); e.focus(); return true;
		}
		var e = elements["fieldName"];
		if(!e.value.match(/^([^\x00-\xff]|\w){1,15}$/)){
			alert('字段名不能为空,并且不能包含特殊字符!');
			e.select(); e.focus(); return true;
		}

		var e = elements['orderId'];
		if( !e.value.match(/^\d{1,2}$/)){
			alert('优先级只能是不大于100的数字');
			e.select(); e.focus(); return true;
		}

		var e = elements['size'];
		if( !e.value.match(/^\d{0,2}$/)){
			alert('Size只能是不大于100的数字');
			e.select(); e.focus(); return true;
		}
	}catch(e){
		return true;
	}

	try{
		var e = elements['regs'];
		if( e.value ){
			var pattern = new RegExp( e.value );
			pattern.test( " changlong" ) 
		}
	}catch(err){
		alert("您输入的不是一个规范的正则表达式!"); e.select(); e.focus();
		return true;
	}
});


(function(){
	function onReset(){
		var needs	= {-$L.need_json|default:"{}"-}
		for(var i in needs){
			for(var j in needs[i]){
				var name	= "need[" + i + "][" + j + "]";
				var ec		= document.getElementsByName( name );
				if( ec.length ){
					ec[0].checked	= true;
				}
			}
		}
	}
	var Timer;
	$('Field_Form').addEvent('reset', function(){
		$clear(Timer);
		Timer	= setTimeout(onReset, 100);
	});
	onReset();
})();
</script>
